<template>
	<view class="new_page">
		<view class="main">
			<view class="order_hx_wrap">
				<view class="img">
					<image src="https://hetp.hephp.cn/static/images/image_product_2.png" mode="heightFix"></image>
				</view>
				<view class="goods_name">
					<text>{{info.eventName}}</text>
				</view>
				
				<view class="wrap">
					<view class="one">
						<view class="text">
							<text>交易单号</text>
						</view>
						<view class="rt no-wrap">{{info.orderId}}</view>
					</view>
					<view class="one">
						<view class="text">
							<text>下单时间</text>
						</view>
						<view class="rt no-wrap">{{info.orderDateTime}}</view>
					</view>
					<!-- <view class="one">
						<view class="text">
							<text>消费时间</text>
						</view>
						<view class="rt no-wrap">{{info.orderId}}</view>
					</view>
					<view class="one">
						<view class="text">
							<text>有效期至</text>
						</view>
						<view class="rt no-wrap">{{info.orderId}}</view>
					</view> -->
					<!-- <view class="one">
						<view class="text">
							<text>数量</text>
						</view>
						<view class="rt no-wrap">1</view>
					</view>
					<view class="one">
						<view class="text">
							<text>总价</text>
						</view>
						<view class="rt no-wrap">¥300</view>
					</view>
					<view class="one">
						<view class="text">
							<text>实付</text>
						</view>
						<view class="rt no-wrap">¥199</view>
					</view>
					<view class="one">
						<view class="text">
							<text>手机号</text>
						</view>
						<view class="rt no-wrap">XXXXXXXXXXXX</view>
					</view> -->
				</view>
				<view class="fix_btn">
					<button v-if="info.orderStatus=='A'"  class="b-bg" @click="orderhx()">核销</button>
					<button v-if="info.orderStatus=='V'"  class="b-grey-bg">订单已核销</button>
					<button v-if="info.orderStatus!='V' && info.orderStatus!='A'"  class="b-grey-bg">订单状态无法核销</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { gethexiaodetail,orderhx } from '@/request/api.js'
	import { toast,useRouter } from '@/request/utils.js'
	export default {
		data() {
			return {
				title: 'Hello',
				id:'',
				info:{
					orderId:'',
					orderDateTime:'',
					eventName:"",
					totalFee:'',
					orderStatus:'',
					VerifiedDatetime:''
				}
			}
		},
		onLoad(openid) {
			console.log(openid)
			this.id = openid.id
			this.gethexiaodetail(openid.id)
		},
		methods: {
			async gethexiaodetail(nums) {
			  let res = await gethexiaodetail({id:nums});
			  if(res.code==200){
				  this.info = res.data
			  }else{
				  toast(res.message)
				  this.goToNoLoginPage('/pages/index/index','navigateBack');
			  }
			},
			async orderhx(){
				let id = this.id
				let res = await orderhx({id:id})
				if(res.code==200){
					this.goToNoLoginPage('/pagesA/success/success','navigateBack');
				}else{
					toast(res.message)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.new_page {
	.main {
		background-color: #fff;
		border-radius: 10rpx;
		margin-top: 30rpx
		
	}
	.order_hx_wrap {
		padding: 30rpx 40rpx;
		.img {
			height: 320rpx;
			background: url('https://hetp.hephp.cn/static/images/image_product_2.png') no-repeat;
			background-size: 100%;
			background-position: center;
			image {
				height: 100%;
			}
		}
		.goods_name {
			margin: 30rpx 0;
			font-size: 36rpx;
			
		}
		.wrap {
			.one {
				display: flex;
				justify-content: space-between;
				align-items: center;
				.rt {
					color: $text-grey;
					text-align: right;
					margin-left: 30rpx;
					flex: 1;
					max-width: 70%;
					padding: 25rpx 0;
					border-bottom: 1px solid $line-grey;
				}
			}
		}
	
		.fix_btn {
			width: 90%;
			margin: auto;
			border-radius: 60rpx;
			overflow: hidden;
			margin: 80rpx auto 40rpx;
		}
	}
}
</style>
